package com.bjpowernode.crm.service.impl;

import com.bjpowernode.crm.mapper.ActivityMapper;
import com.bjpowernode.crm.mapper.ActivityRemarkMapper;
import com.bjpowernode.crm.pojo.Activity;
import com.bjpowernode.crm.pojo.ActivityRemark;
import com.bjpowernode.crm.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ActivityServiceImpl implements ActivityService {
    @Autowired
    private ActivityMapper activityMapper;

    @Autowired
    private ActivityRemarkMapper activityRemarkMapper;

    @Override
    public List getByConditions(Map conditions) {
        return activityMapper.getByConditions(conditions);
    }

    public void save(Activity activity) {
        System.out.println(activity);
        activityMapper.save(activity);
    }

    public Activity getById(String id) {
        return activityMapper.getById(id);
    }

    public void edit(Activity activity) {
        activityMapper.edit(activity);
    }

    @Override
    public void saveList(List data) {
        activityMapper.saveList(data);
    }

    @Override
    public List getRemarks(String actId) {
        return activityRemarkMapper.getByActId(actId);
    }

    public void saveRemark(ActivityRemark activityRemark) {
        activityRemarkMapper.save(activityRemark);
    }

    @Override
    public void editRemark(ActivityRemark activityRemark) {
        activityRemarkMapper.edit(activityRemark);
    }

    public void delRemark(String id) {
        activityRemarkMapper.delete(id);
    }
}
